#!/usr/bin/env python
# -*- coding: UTF-8 -*-
'''
@Project ：图灵学习 
@File    ：11.协程预处理.py
@IDE     ：PyCharm 
@Author  ：ChenLiGao
@Date    ：2024-11-07 20:15
'''
import asyncio


async def work1():
    print("这是任务1")

    await asyncio.sleep(2)
    print("任务1完成")


async def work2():
    print("这是任务2")

    await asyncio.sleep(2)
    print("任务2完成")

async def main():
    task_list = [loop.create_task(work1()), loop.create_task(work2())]
    await asyncio.sleep(2)

if __name__ == '__main__':
    loop = asyncio.get_event_loop()
    loop.run_until_complete(main())